package cn.tedu.quartz;

import org.quartz.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//@Configuration
public class QuartzJobConfig {
    //@Bean
    public JobDetail jobDetail(){
        return JobBuilder.newJob(SimpleQuartzJob.class)
                .withIdentity("job1", "group1")
                .storeDurably()
                .build();
    }
    //@Bean
    public Trigger jobTrigger(){
        return TriggerBuilder.newTrigger()
                .forJob(jobDetail())
                .withIdentity("trigger1", "group1") //唯一标识
                .withSchedule(CronScheduleBuilder.cronSchedule("0/3 * * * * ?"))
                .build();
    }
}
